home *** CD-ROM | disk | FTP | other *** search
/ Tech Arsenal 1 / Tech Arsenal (Arsenal Computer).ISO / tek-02 / jed10.zip / RULER.MAC < prev    next >
Text File  |  1993-02-26  |  2KB  |  31 lines

  1. ;---------------------------------------------------------------
  2. ;   RULER    --  Displays a "1234567890"-style ruler on-screen
  3. ;   Last update 11/25/91
  4. ;
  5. ;      Caller must pass:
  6. ;      In VidAddress: The address of the start of the video buffer
  7. ;      In Length:  The length of the ruler to be displayed
  8. ;      In ScreenW: The width of the current screen (usually 80)
  9. ;      In ScreenY: The line of the screen where the ruler is
  10. ;                  to be displayed (0-24)
  11. ;      In ScreenX: The row of the screen where the ruler should
  12. ;                  start (0-79)
  13. ;      Action:     Displays an ASCII ruler at ScreenX,ScreenY.
  14. ;---------------------------------------------------------------
  15. Ruler      MACRO VidAddress,Length,ScreenW,ScreenX,ScreenY
  16.            les    DI,DWORD PTR VidAddress
  17.            add    DI,(ScreenY*ScreenW)  ; Calculate Y offset into vidbuf
  18.            add    DI,ScreenX   ; Add X offset into vidbuf
  19.            mov    CX,Length    ; CX monitors the ruler length
  20.            mov    AH,07        ; Attribute 7 is "normal" text
  21.            mov    AL,'1'       ; Start with digit "1"
  22.  
  23. DoChar:    stosw               ; Note that there's no REP prefix!
  24.            add    AL,'1'       ; Bump the character value in AL up by 1
  25.            aaa                 ; Adjust AX to make this a BCD addition
  26.            add    AL,'0'       ; Basically, put binary 3 in AL's high nybble
  27.            mov    AH,07        ; Make sure our attribute is still 7
  28.            loop   DoChar       ; Go back & do another char until BL goes to 0
  29.  
  30.            ENDM
  31.